//
//  BaseTabBarViewController.m
//  xmppones
//
//  Created by 李立达 on 2017/2/17.
//  Copyright © 2017年 李立达. All rights reserved.
//

#import "BaseTabBarViewController.h"
#import "BaseNavigationViewController.h"
#import "ListMesViewController.h"
#import "messgesViewController.h"
#import "mysourceViewController.h"
#import "groupViewController.h"
@interface BaseTabBarViewController ()

@end
#define COLOR_RGB(r,g,b) ([UIColor colorWithRed:(r / 255.0) green:(g / 255.0) blue:(b / 255.0) alpha:1.0])
@implementation BaseTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [UITabBar appearance].translucent = NO;
    [[UITabBar appearance] setBarTintColor:COLOR_BLUDBUTTON];
    [self addControllers];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)addControllers
{
    [self addChildViewController:[[messgesViewController alloc]init] title:@"聊天" imageName:@"tabBar_home_n" selectedImageName:@"tabBar_home_s"];
    [self addChildViewController:[[ListMesViewController alloc]init] title:@"联系人" imageName:@"tabBar_find_n" selectedImageName:@"tabBar_find_s"];
    [self addChildViewController:[[groupViewController alloc]init] title:@"群聊" imageName:@"tabBar_launch_s" selectedImageName:@"tabBar_launch_s"];
    [self addChildViewController:[[mysourceViewController alloc]init] title:@"我的" imageName:@"tabBar_me_n" selectedImageName:@"tabBar_me_s"];
}
- (void)addChildViewController:(UIViewController *)childController title:(NSString *)title imageName:(NSString *)imageName selectedImageName:(NSString *)selectedImage
{
    childController.title = title;
    childController.tabBarItem.image =[UIImage imageNamed:imageName];
    childController.tabBarItem.selectedImage = [UIImage imageNamed:selectedImage];
    BaseNavigationViewController *nav = [[BaseNavigationViewController alloc]initWithRootViewController:childController];
    [self addChildViewController:nav];
}
@end
